package protocol.meta;

import java.util.ArrayList;
import java.util.List;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 找朋友的过滤器
 *
 */
public class FilterInfo implements Parcelable{

    public int gender = -1;// 性别 1:男 2:女 -1:不限
    public String province;// 省
    public String city;// 城市
    public int userType = -1;// 用户类型，0普通用，1官方用户，-1:不限
    public boolean gameFilter;//是否开启游戏过滤
    public List<String> subjectIdList;// 游戏过滤列表

    public static final Parcelable.Creator<FilterInfo> CREATOR = new Parcelable.Creator<FilterInfo>() {

        @Override
        public FilterInfo createFromParcel(Parcel in) {
            return new FilterInfo(in);
        }

        @Override
        public FilterInfo[] newArray(int size) {
            return new FilterInfo[size];
        }
    };


    public FilterInfo() {
        subjectIdList = new ArrayList<String>();
    }

    private FilterInfo(Parcel in) {
        gender = in.readInt();// 性别 1:男 2:女 3:保密
        province = in.readString();// 省
        city = in.readString();// 城市
        userType = in.readInt(); // 用户类型，0普通用，1官方用户
        gameFilter = (Boolean)in.readValue(boolean.class.getClassLoader());
        subjectIdList = new ArrayList<String>();
        in.readList(subjectIdList, List.class.getClassLoader());
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(gender);
        dest.writeString(province);
        dest.writeString(city);
        dest.writeInt(userType);
        dest.writeValue(gameFilter);
        dest.writeList(subjectIdList);
    }
}
